package com.brand.data.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.AsyncConfigurerSupport;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;

/**
 * @author scl.BlueOcean
 * @version 1.0
 * @date 2018年04月11 14:33
 * @description
 */
@Configuration
@EnableAsync(proxyTargetClass= true)
public class AsyncConfig extends AsyncConfigurerSupport
{
    @Bean(name={"threadPoolTaskExecutor"})
    public ThreadPoolTaskExecutor getAsyncExecutor()
    {
        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
        executor.setCorePoolSize(10);
        executor.setMaxPoolSize(100);
        executor.setQueueCapacity(2000);
        executor.initialize();
        return executor;
    }
}
